Added minimal version check for log
authorJeroen van der Heijden <jeroen@transceptor.technology>
Fri, 16 Mar 2018 12:17:22 +0000 (13:17 +0100)
committerJeroen van der Heijden <jeroen@transceptor.technology>
Fri, 16 Mar 2018 12:17:22 +0000 (13:17 +0100)
include/siri/db/insert.h
src/siri/db/insert.c
src/siri/net/clserver.c

index b31e7ff872d6896fca13dc39e6e3b7b894d457b7..6e289a14c33b73987628c809180461b385503743 100644 (file)
@@ -32,6 +32,7 @@ typedef enum
     ERR_UNSUPPORTED_VALUE,
     ERR_EXPECTING_AT_LEAST_ONE_POINT,
     ERR_EXPECTING_NAME_AND_POINTS,
+    ERR_INCOMPATIBLE_SERVER_VERSION,
     ERR_MEM_ALLOC,          // This is a critical error.
 } siridb_insert_err_t;
 
index cc78b324a8a3c2020f46734b21ef327ef0cff90c..111533086fd57dff01c68be4fb5b08eaf48dfd7b 100644 (file)
@@ -112,12 +112,15 @@ const char * siridb_insert_err_msg(siridb_insert_err_t err)
     case ERR_TIMESTAMP_OUT_OF_RANGE:
         return  "Received at least one time-stamp which is out-of-range.";
     case ERR_UNSUPPORTED_VALUE:
-        return  "Unsupported value received. (only integer and float "
+        return  "Unsupported value received. (only integer, float and string "
                 "values are supported).";
     case ERR_EXPECTING_AT_LEAST_ONE_POINT:
         return  "Expecting a series to have at least one point.";
     case ERR_EXPECTING_NAME_AND_POINTS:
         return  "Expecting a map with name and points.";
+    case ERR_INCOMPATIBLE_SERVER_VERSION:
+        return  "At least one server is incompatible for handling this "
+                "insert.";
     case ERR_MEM_ALLOC:
         return  "Critical memory allocation error";
     default:
@@ -1420,6 +1423,10 @@ static int INSERT_read_points(
         switch (qp_next(unpacker, qp_obj))
         {
         case QP_RAW:
+            if (siridb_servers_check_version(siridb, "2.0.27") > 0)
+            {
+                return ERR_INCOMPATIBLE_SERVER_VERSION;
+            }
             qp_add_raw(packer, qp_obj->via.raw, qp_obj->len);
             break;
 
index 27a2e5bb8b93b3691e61d0e260d0e4dc75f61fd6..dceaf72fa64256a295e058091d1510cdcd6f7896 100644 (file)
@@ -528,6 +528,7 @@ static void on_insert(uv_stream_t * client, sirinet_pkg_t * pkg)
         case ERR_UNSUPPORTED_VALUE:
         case ERR_EXPECTING_AT_LEAST_ONE_POINT:
         case ERR_EXPECTING_NAME_AND_POINTS:
+        case ERR_INCOMPATIBLE_SERVER_VERSION:
         case ERR_MEM_ALLOC:
             {
                 /* something went wrong, get correct err message */